﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Cielo.API.XML.Helpers
{
    internal class XmlTagBuilder
    {

        private static XmlDocument _xmlDocument;
        private static XmlDocument xmlDocument
        {
            get { return _xmlDocument ?? (_xmlDocument = new XmlDocument()); }
        }

        public static XmlElement CreateXmlElement(string name)
        {
            return xmlDocument.CreateElement(name);
        }
        public static XmlElement CreateXmlElement(string name, object value)
        {
            var element = XmlTagBuilder.CreateXmlElement(name);
            element.InnerText = Convert.ToString(value);
            return element;
        }
        public static XmlAttribute CreateXmlAttribute(String name)
        {
            return xmlDocument.CreateAttribute(name);
        }
        public static XmlAttribute CreateXmlAttribute(String name, string value)
        {
            var attribute = CreateXmlAttribute(name);
            attribute.Value = value;
            return attribute;

        }

    }
}
